package com.situ.mall.admin.task;

import com.situ.mall.common.service.IAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author yangkx
 * @create 2023-09-25-21:13
 */
@Component
public class CleanTask {

    @Autowired
    private IAttachmentService attachmentService;

    //清理数据库中的脏数据
    //cron表达式：定制一个调度的规则
    @Scheduled(cron = "0/10 * * * * ? ")
    public void cleanAttachment(){
        attachmentService.clean();
    }
}
